package edu.nf.admin.controller.admin;

import edu.nf.waimai.dao.admin.impl.OrderMarkDaoImpl;
import org.nf.web.annotation.RequestMapping;
import org.nf.web.servlet.View;
import org.nf.web.servlet.view.JsonView;

import java.math.BigDecimal;

/**
 * @Date 2023-09-10
 * @Author qiu
 */
public class OrderMarkController extends BaseController {

    /**
     * 查询用户订单数量
     * @return
     */
    @RequestMapping("/edu/nf/admin/controller/admin/userOrder")
    public View queryUserOrderCount(){
        long count = new OrderMarkDaoImpl().queryUserOrderCount();
        int i = Integer.parseInt(String.valueOf(count));
        System.out.println(i);
        return new JsonView(success(i));
    }

    /**
     * 查询商家出单量
     * @return
     */
    @RequestMapping("/edu/nf/admin/controller/admin/shopOrder")
    public View queryShopOrderCount(){
        long count = new OrderMarkDaoImpl().queryShopOrderCount();
        int i = Integer.parseInt(String.valueOf(count));
        System.out.println(i);
        return new JsonView(success(i));
    }

    /**
     * 查询骑手接单量
     * @return
     */
    @RequestMapping("/edu/nf/admin/controller/admin/RiderOrder")
    public View queryRiderOrderCount(){
        long count = new OrderMarkDaoImpl().queryRiderOrderCount();
        int i = Integer.parseInt(String.valueOf(count));
        System.out.println(i);
        return new JsonView(success(i));
    }

    /**
     * 平台收取骑手和商家的利润
     * @return
     */
    @RequestMapping("/edu/nf/admin/controller/admin/AllOrder")
    public View queryAllCount(){
        BigDecimal aLong = new OrderMarkDaoImpl().queryAllCount();
        BigDecimal bigDecimal = new BigDecimal(0.1);
        BigDecimal bigDecimal1 = new BigDecimal(0.2);
        BigDecimal shop = aLong.multiply(bigDecimal);
        BigDecimal rider = aLong.multiply(bigDecimal1);
        BigDecimal count = shop.add(rider);
        System.out.println(count);
        return new JsonView(success(count));
    }

    /**
     * 收取商家的利润
     * @return
     */
    @RequestMapping("/edu/nf/admin/controller/admin/shopMoney")
    public View queryShopMoney(){
        BigDecimal bigDecimal = new OrderMarkDaoImpl().queryAllCount();
        BigDecimal bigDecimal1 = new BigDecimal(0.1);
        BigDecimal multiply = bigDecimal.multiply(bigDecimal1);
        return new JsonView(success(multiply));
    }


    /**
     * 收取骑手的利润
     * @return
     */
    @RequestMapping("/edu/nf/admin/controller/admin/riderMoney")
    public View queryRiderMoney(){
        BigDecimal bigDecimal = new OrderMarkDaoImpl().queryAllCount();
        BigDecimal bigDecimal1 = new BigDecimal(0.2);
        BigDecimal multiply = bigDecimal.multiply(bigDecimal1);
        return new JsonView(success(multiply));
    }

}
